package com.pointi.PatternExtractor;

import java.util.ArrayList;

public class emoParam
{
	private ArrayList<String> param_list ;
	private ArrayList<Integer> param_order ;
	
	public emoParam()
	{
		param_list = new ArrayList<String>() ;
		param_order = new ArrayList<Integer>() ;
		this.fnInitialize() ;
	}
	
	private void fnInitialize()
	{
		param_order.add(5) ; param_list.add("ai") ;
		param_order.add(4) ; param_list.add("dur") ;
		param_order.add(3) ; param_list.add("ht") ;
		param_order.add(2) ; param_list.add("td") ;
		param_order.add(1) ; param_list.add("tt") ;
		param_order.add(0) ; param_list.add("mt") ;
	}
	
	public void fnInitialize(String param_list, String param_order)
	{
		String [] sa_list = param_list.split(",") ;
		String [] sa_order = param_order.split(",") ;
		
		int min = 9999 ;
		int [] ia_order = new int[sa_order.length] ;

		this.param_list.clear() ;
		this.param_order.clear() ;

		if(sa_list.length != sa_order.length) {
			System.out.println(String.format("[PE][ERROR] Parameter Count does not match ! (%d / %d)", sa_list.length, sa_order.length)) ;
		}
		
		for(int i=0; i<sa_list.length; i++) {
			this.param_list.add(sa_list[i]) ;
		}
		for(int i=0; i<sa_order.length; i++) {
			ia_order[i] = Integer.valueOf(sa_order[i]) ;
			if(min > ia_order[i]) { min = ia_order[i] ; }
		}
		if(min != 0) { for(int i=0; i<sa_order.length; i++) { ia_order[i] -= min ; } }
		for(int i=0; i<sa_order.length; i++) {
			this.param_order.add(ia_order[i]) ;
		}
	}
	
	public int length() { return this.param_list.size() ; }
	public String param(int idx) { return this.param_list.get(this.param_order.get(idx)) ; }
	public int order(int idx) { return (this.param_order.get(idx) + 1) ; }
}
